<template>
    <div>
        <a href="/add">食谱新增</a>
        <a href="/kfshow">康复显示</a>
        <h1>食谱显示</h1>
        标签<input type="text" v-model="info.names">
        分类<select v-model="info.retid">
            <option value="">请选择</option>
            <option v-for="a in lisr" :value="a.Id">{{ a.RetName }}</option>
        </select>
        <input type="button" value="查询" @click="getlist">
        <table class="table table-bordered">
            <thead>
                <tr>
                    <th>Id</th>
                    <th>食品标签</th>
                    <th>分类</th>
                    <th>上传图片</th>
                </tr>
            </thead>
            <tbody>
                <tr v-for="a in data">
                    <td>{{ a.Id }}</td>
                    <td>{{ a.Name }}</td>
                    <td>{{ a.RetName }}</td>
                    <td><img :src="a.Img" width="60" height="60"></td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
import { useRouter } from 'vue-router';
import axios from 'axios';
const router = useRouter();
let info: any = reactive({
    names: '',
    retid: ''
})
let lisr: any = ref([]);
let data: any = ref([]);
onMounted(() => {
    getlist();
    getlisr();
})
const getlisr = () => {
    axios({
        url: '/api/User/GetFL',
        method: 'get'
    })
        .then(res => {
            console.log(res);
            lisr.value = res.data
        })
        .catch(err => {
            console.log(err);

        })
}
const getlist = () => {
    axios({
        url: '/api/User/GetRet',
        method: 'get',
        params: info
    })
        .then(res => {
            console.log(res);
            data.value = res.data
        })
        .catch(err => {
            console.log(err);

        })
}
</script>

<style scoped></style>